package file;

import java.io.File;

/**
 * 拿到目录的所有子项
 */
public class FileListDemo {
    public static void main(String[] args) {
        File file = new File("./src/file/");
        if (file.isDirectory()) {
            File[] files = file.listFiles();
            System.out.println("有几个子项"+files.length);
            for (int i = 0; i < files.length; i++) {
                System.out.println(files[i].getName());
            }
        }
    }
}
